<template>
  <div class="maintenance-record">
    <el-table :data="tableData" border>
      <el-table-column label="序号" type="index" width="50px"></el-table-column>
      <el-table-column prop="maintainTime" label="维护预警时间"></el-table-column>
      <el-table-column prop="loopTime" label="维护周期"></el-table-column>
      <el-table-column prop="content" label="需维护内容" show-overflow-tooltip></el-table-column>
      <el-table-column prop="status" label="维护状态" width="100px">
        <template slot-scope="scope">
          <el-tag type="error" v-if="scope.row.status == 0">未处理</el-tag>
          <el-tag type="success" v-else-if="scope.row.status == 1">已处理</el-tag>
          <span v-else>{{ scope.row.status }}</span>
        </template>
      </el-table-column>
    </el-table>
    <div class="pagination">
      <el-pagination
        background
        :page-size="pageVO.pageSize"
        :current-page.sync="pageVO.pageNum"
        :total="pageVO.total"
        :layout="pageOptions.layout"
        :page-sizes="pageOptions.pageSizes"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
  </div>
</template>

<script>
import pageQuery from '../../../mixins/pageQuery';
import { getFaultDetail } from '@/api/maintenance';
export default {
  mixins: [pageQuery],
  data() {
    return {
      tableData: [],
    };
  },
  methods: {
    getTableData(pageNum) {
      if (pageNum) {
        this.pageVO.pageNum = pageNum;
      }
      getFaultDetail({
        pageNo: this.pageVO.pageNum,
        pageSize: this.pageVO.pageSize,
        projectId: this.$store.getters.projectId,
      }).then(res => {
        const { data, total } = res.data || {};
        this.tableData = data || [];
        this.pageVO.total = total;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.maintenance-record {
}
</style>
